<?php
/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use app\assets\AppAsset;
use yii\helpers\Url;
AppAsset::register($this);


?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title></title>
    <?php $this->head() ?>

    <?php
    //使用率
    echo $this->render("@app/views/public/useRate.php")
    ?>


    <script>
        function showMyAlert(msg) {
            var oWindow = $("<div id='windows-msg' class='text-center' style='padding:20px'></div>");
            oWindow.append(msg).appendTo("body");
            oWindow.kendoWindow({
                minWidth: 200,
                minHeight: 50,
                maxWidth:600,
                title: "系统信息",
                modal: true,
                visible: false,
                resizable: false,
                actions: [
                    "Close"
                ],
            }).data("kendoWindow").center().open();
        }


        /**
         * [showMyWindow 打开一个windows窗口]
         * @param  {[type]}  title     [窗口标题]
         * @param  {[type]}  url       [内容路径]
         * @param  {Number}  width     [description]
         * @param  {Number}  height    [description]
         * @param  {String}  gridIdStr [kendoGrid 对象ID 如  #grid]
         * @param  {Boolean} isIframe  [description]
         * @return 无返回直接弹窗
         */
        function showMyWindow(title,url,width=800,height=600,gridIdStr="",isIframe=true){
            $("<div id='popupWindow'></div>")
                .appendTo("body")
                .kendoWindow({
                    height: height,
                    width: width,
                    minWidth: 800,
                    minHeight: 250,
                    modal: true,
                    actions: [
                        "pin",
                        "minimize",
                        "maximize",
                        "close"
                    ],
                    title: title,
                    visible: false,
                    iframe: isIframe,
                    animation: {
                        open: {
                            effects: "fade:in"
                        }
                    },
                    content: {
                        url: url
                    },
                    open: function (e) {
                        kendo.ui.progress(e.sender.element, true);
                    },
                    refresh: function (e) {
                        kendo.ui.progress(e.sender.element, false);
                    },
                    close: function (e) {
                        this.destroy();
                        if(!$.isEmptyObject(gridIdStr)){
                            $(gridIdStr).data("kendoGrid").dataSource.read();
                        }
                    }
                }).data("kendoWindow").center().open();
        }
    </script>

</head>
<body>
<?php $this->beginBody() ?>
<?php $this->endBody() ?>
        <?= $content; ?>
</body>
</html>
<?php $this->endPage() ?>
